import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue';
import goods from './goods' //商品管理
import operate from './operate' //运营管理
import promotion from './promotion' //推广管理
import system from './system' //系统管理

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   component: Home,
  //   redirect: "/Login",
  // },
  // {
  //   path: '/Login',
  //   component: () => import('../views/Login.vue'),
  // },
  {
    path: '/',
    redirect: '/Login'
  },
  {
    path: '/Login',
    name: 'Login',
    component: Login
  },
  {
    path: '/Home',
    component: Home,
    children:[
      {
        path: '/Directory',
        name: '首页',
        meta:{title: "首页"},
        component: () => import('../views/Directory.vue'),
      },
      {
        path: '/About',
        name: 'About',
        component: () => import('../views/About.vue')
      }
   ]
  },
  //商品管理
  {
    path: '/goods',
    name: '商品管理',
    meta:{title: "商品管理"},
    component: () => import('../views/Home.vue'),
    children:[
       ...goods
    ]
  },
  //运营管理
  {
    path: '/operate',
    name: '运营管理',
    meta:{title: "运营管理"},
    component: () => import('../views/Home.vue'),
    children:[
       ...operate
    ]
  },
  //推广管理
  {
    path: '/promotion',
    name: '推广管理',
    meta:{title: "推广管理"},
    component: () => import('../views/Home.vue'),
    children:[
       ...promotion
    ]
  },
  //系统管理
  {
    path: '/system',
    name: '商品管理',
    meta:{title: "商品管理"},
    component: () => import('../views/Home.vue'),
    children:[
       ...system
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router;
